//********************************************************************************************************************//
//ORGANIZATION:
//AUTHOR: bpeng(bogers.peng@gmail.com)
//SUMMARY:
//********************************************************************************************************************//
#ifndef NATIVE_SYSTEM_UTILITY_TESTING_H
#define NATIVE_SYSTEM_UTILITY_TESTING_H

#ifndef NATIVE_SYSTEM_BASE_OBJECT_H
#include "System/Base/Object.h"
#endif
#ifndef NATIVE_SYSTEM_BASE_ITERATE_H
#include "System/Base/Iterate.h"
#endif
#ifndef NATIVE_SYSTEM_BASE_EQUALTO_H
#include "System/Base/EqualTo.h"
#endif

#include "stdafx.h"
#include "CppUnitTest.h"

using namespace Native::System;

namespace Native { namespace System { namespace Utility
{
    struct UEquivalentTester
    {
        template<typename _TObject>
        static void CheckByEqualTo(IEqualTo<_TObject>* base, const _TObject& contrast, bool expected)
        {
            Assert::AreEqual(base->operator==(contrast), expected);
            Assert::AreNotEqual(base->operator!=(contrast), expected);
        }
    };

    struct UConstructorTester
    {
        template<typename _TObject>
        static void CheckByEqualTo(const _TObject& base)
        {
            auto make_copied_object = [&]() {
                return base;
            };
            auto make_moved_object = [&]() {
                _TObject object(base);
                return move(object);
            };

            _TObject copied_object(make_copied_object());
            _TObject moved_object(make_moved_object());

            Assert::IsTrue(copied_object == base);
            Assert::IsTrue(moved_object == base);
        };
    };
}}

#endif